import request from '@/utils/request'

export function login(username, password, domain) {
  return request({
    url: '/user/login',
    method: 'post',
    data: {
      'User': username,
      'Password': password,
      'Domain': domain
    }
  })
}

export function getInfo(token) {
  return request({
    url: '/user/whoami',
    method: 'get',
    params: {
      token
    }
  })
}

export function updateToken() {
  return request({
    url: '/user/gettoken',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: '/user/logout',
    method: 'get'
  })
}

export function listMyModule() {
  return request({
    url: '/module/list',
    method: 'get'
  })
}

export function listDomain(loginname) {
  return request({
    url: '/domain/listbylogincode',
    params: {
      'logincode': loginname
    },
    method: 'get'
  })
}
